<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<style type="text/css">
		canvas{
			border: 1px solid #000;
		}
	</style>
</head>
<body>
	<canvas id="canvas" width="800" height="500">你的浏览器不支持canvas</canvas>
	<script type="text/javascript">
		//得到标签
		var canvas = document.getElementById("canvas");
		//上下文
		var ctx = canvas.getContext("2d");
		
		//创建一个图片对象
		var image = new Image();
		//设置src，一旦设置src属性了，那么上行请求将发出。
		image.src = "images/0.jpg";
		//图片必须写onload事件，才能drawImage。
		image.onload = function(){
			ctx.drawImage(image, 206,119,51,50, 100,100,51,50);
		}
	</script>
</body>
</html>